/* 
 * 系统用户存储
 */
import { defineStore } from 'pinia'

export const useUserStore = defineStore({
    id: 'userStore',
    state: () => ({
        // 用户信息
        userInfo: null,
        token: '',
        // 角色列表
        roleList: [],
        // 字典
        dictItems: null,
        // session过期时间
        sessionTimeout: false,
        // Last fetch time
        lastUpdateTime: 0,
        // 租户id
        tenantid: '',
        // 分享租户ID，用于分享页面所属租户与当前用户登录租户不一致的情况
        shareTenantId: null,
        //登录返回信息
        loginInfo: null,
        //班组绩效兼职列表及默认值
        teamList: [],
        orgCode: undefined,
        orgName: undefined,
        toBeDoneCount: 1,
    }),
    getters: {
        getToken(): string {
            return this.token
        },
        bigSum: state => state.toBeDoneCount * 10,
    },

    actions: {
        increment(value: number) {
        },
        setToken(token: string) {
            this.token = token;
        },
        setUserInfo(data) {
            this.userInfo = data;
            this.lastUpdateTime = new Date().getTime();
        },
    },


})